﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FieldItem.aspx.cs" Inherits="Manage_Cms_Fielditem" %>

<html>
<head>
    <!--#include file="../js/html_head.inc"-->
    <link rel="stylesheet" type="text/css" href="../Themes/<%=ManageHelper.GetTheme()%>/style.css" />
</head>
<body>
    <form id="form1" action="?method=<%=KeRui.Common.PageRequest.GetString("act") %>&siteid=<%=KeRui.Common.PageRequest.GetInt("siteid",-1) %>&fieldID=<%=KeRui.Common.PageRequest.GetInt("fieldID",-1) %>"
        onsubmit="return validator(this)" method="post">

        <script type="text/javascript">
        <%if(modelCmsFieldShow.FieldID==0)
{
    %>
            $(document).ready(function(){
            $("#trDefaultValue").show();
            $("#trinputlength").show();
            $("#trmax").show();
            $("#trwidth").hide();
            $("#height").hide();
            $("#selectlist").hide();
            $("#datetime").hide();
            $("#datedefault").hide();
            $("#trfieldplusattr").hide();
        });
    <%}%>
        function disDiv()
            {
               switch($('#fieldtype').val())
               {
                 case '1':
                    $("#trDefaultValue").show();
                    $("#trinputlength").show();
                    $("#trmax").show();
                    $("#trwidth").hide();
                    $("#height").hide();
                    $("#selectlist").hide();
                    $("#datetime").hide();
                    $("#datedefault").hide();
                    $("#trfieldplusattr").hide();
                    break;
                 case '2':
                    $("#trDefaultValue").show();
                    $("#trinputlength").hide();
                    $("#trmax").hide();
                    $("#trwidth").show();
                    $("#height").show();
                    $("#selectlist").hide();
                    $("#datetime").hide();
                    $("#datedefault").hide();
                    $("#trfieldplusattr").hide();
                    break;
                 case '3':
                    $("#trDefaultValue").show();
                    $("#trinputlength").hide();
                    $("#trmax").hide();
                    $("#trwidth").show();
                    $("#height").show();
                    $("#selectlist").hide();
                    $("#datetime").hide();
                    $("#datedefault").hide();
                    $("#trfieldplusattr").hide();
                    break;
                 case '4':
                 case '7':
                    $("#trDefaultValue").show();
                    $("#trinputlength").hide();
                    $("#trmax").hide();
                    $("#trwidth").hide();
                    $("#height").hide();
                    $("#selectlist").show();
                    $("#datetime").hide();
                    $("#datedefault").hide();
                    $("#trfieldplusattr").hide();
                    break;
                 case '8':
                    $("#trDefaultValue").show();
                    $("#trinputlength").hide();
                    $("#trmax").hide();
                    $("#trwidth").hide();
                    $("#height").hide();
                    $("#selectlist").hide();
                    $("#datetime").hide();
                    $("#datedefault").hide();
                    $("#trfieldplusattr").hide();
                    break;
                 case '9':
                    $("#trDefaultValue").hide();
                    $("#trinputlength").hide();
                    $("#trmax").hide();
                    $("#trwidth").hide();
                    $("#height").hide();
                    $("#selectlist").hide();
                    $("#datetime").show();
                    $("#datedefault").show();
                    $("#trfieldplusattr").hide();
                    break;
                 case '10':
                    $("#trDefaultValue").show();
                    $("#trinputlength").hide();
                    $("#trmax").hide();
                    $("#trwidth").hide();
                    $("#height").hide();
                    $("#selectlist").hide();
                    $("#datetime").hide();
                    $("#datedefault").hide();
                    $("#trfieldplusattr").hide();
                    break;
                case '11':
                    $("#trDefaultValue").hide();
                    $("#trinputlength").hide();
                    $("#trmax").hide();
                    $("#trwidth").hide();
                    $("#height").hide();
                    $("#selectlist").hide();
                    $("#datetime").hide();
                    $("#datedefault").hide();
                    $("#trfieldplusattr").show();
                    break;
               }
            }

        </script>

        <table cellpadding="2" width="95%" align="center">
            <tr align="left">
                <td colspan="2">
                    <span id="Message" style="display: inline-block; width: 100%; text-align: center;
                        color: #FF0000"></span>
                </td>
            </tr>
            <tr>
                <td width="290" align="left">
                    <img name="help1" src="../pic/icons/help.gif" alt="栏目名称" onclick="helpInf(this)" />&nbsp;栏目：
                </td>
                <td align="left">
                    <select name="nodeiddropdownlist" onchange="ChangePage()" id="NodeIDDropDownList"
                        style="width: 124px">
                        <%
                            foreach (KeRui.Model.CmsModel model in listCmsModel)
                            {
                                if (model.ModelID == KeRui.Common.PageRequest.GetInt("modelid", -1) || model.ModelID == modelCmsFieldShow.ModelID)
                                {
                        %>
                        <option value="<%=model.ModelID %>" selected="selected">
                            <%=model.ModelName %>
                        </option>
                        <%
                            }
                            else
                            {
                        %>
                        <option value="<%=model.ModelID %>">
                            <%=model.ModelName %>
                        </option>
                        <%
                            }
                        } %>
                    </select>
                </td>
            </tr>
            <tr>
                <td width="200" align="left">
                    <img name="help1" src="../pic/icons/help.gif" alt="字段名" onclick="helpInf(this)" />&nbsp;字段名：</td>
                <td align="left">
                    <input name="fieldname" type="text" valid="required|isWord" errmsg="字段名不能为空|字段名不能以数字开头或不能有下划线"
                        value="<%=modelCmsFieldShow.FieldName %>" /><span class="redstar">*</span>
                    <br />
                    <span style="color: blue">注：字段名由字母、数字、下划线组成，并且仅能字母开头，不以下划线结尾</span>
                </td>
            </tr>
            <tr>
                <td width="200" align="left">
                    <img name="help1" src="../pic/icons/help.gif" alt="字段别名" onclick="helpInf(this)" />&nbsp;字段别名：</td>
                <td align="left">
                    <input name="fieldalias" type="text" value="<%=modelCmsFieldShow.FieldAlias %>" valid="required"
                        errmsg="请输入字段别名。" /><span class="redstar">*</span>
                </td>
            </tr>
            <tr>
                <td width="200" align="left">
                    <img name="help1" src="../pic/icons/help.gif" alt="提示信息" onclick="helpInf(this)" />&nbsp;提示信息：</td>
                <td align="left">
                    <input name="tips" type="text" value="<%=modelCmsFieldShow.Tips %>" />
                </td>
            </tr>
            <tr>
                <td width="200" align="left">
                    <img name="help1" src="../pic/icons/help.gif" alt="字段描述" onclick="helpInf(this)" />&nbsp;字段描述：</td>
                <td align="left">
                    <textarea name="summary" cols="80" rows="5"><%=modelCmsFieldShow.Description%></textarea>
                </td>
            </tr>
            <tr>
                <td width="200" align="left">
                    <img name="help1" src="../pic/icons/help.gif" alt="是否允许为空" onclick="helpInf(this)" />&nbsp;是否允许为空：</td>
                <td align="left">
                    <input id="isnull" type="radio" name="isnull" value="1" <%=modelCmsFieldShow.EnableNull?"checked='checked'":"" %> /><label
                        for="isnull">是</label><input id="isnotnull" type="radio" name="isnull" value="0"
                            <%=!modelCmsFieldShow.EnableNull?"checked='checked'":""%> /><label for="isnotnull">否</label>
                </td>
            </tr>
            <tr>
                <td align="left">
                    <img name="help1" src="../pic/icons/help.gif" alt="是否允许搜索" onclick="helpInf(this)" />&nbsp;是否允许搜索：</td>
                <td align="left">
                    <input id="searchenable" type="radio" name="searchenable" value="1" <%=modelCmsFieldShow.EnableSearch?"checked='checked'":"" %> /><label
                        for="searchenable">是</label><input id="searchdisable" <%=!modelCmsFieldShow.EnableSearch?"checked='checked'":"" %>
                            type="radio" name="searchenable" value="0" /><label for="searchdisable">否</label>
                </td>
            </tr>
            <tr>
                <td width="229" align="left">
                    <img name="help1" src="../pic/icons/help.gif" alt="是否显示在添加页面" onclick="helpInf(this)" />&nbsp;是否显示：</td>
                <td align="left">
                    <input id="using" type="radio" name="using" value="1" <%=modelCmsFieldShow.FieldID==0?"checked='checked'":"" %>
                        <%=modelCmsFieldShow.IsUsing?"checked='checked'":"" %> /><label for="using">是</label><input
                            id="notusing" <%=!modelCmsFieldShow.IsUsing&&modelCmsFieldShow.FieldID!=0?"checked='checked'":"" %>
                            type="radio" name="using" value="0" /><label for="notusing">否</label>
                </td>
            </tr>
            <tr>
                <td width="200" align="left">
                    <img name="help1" src="../pic/icons/help.gif" alt="字段类型" onclick="helpInf(this)" />&nbsp;字段类型：</td>
                <td width="200" align="left">
                    <input name="fieldtypehidden" type="hidden" value="<%=modelCmsFieldShow.FieldType %>" />
                    <select name="fieldtype" id="fieldtype" onchange="disDiv()" style="width: 124px"
                        <%=KeRui.Common.PageRequest.GetString("act")=="modify"?"disabled='disabled'":"" %>>
                        <option value="1" <%=modelCmsFieldShow.FieldType==1?"selected='selected' ":"" %>>单行文本</option>
                        <option value="2" <%=modelCmsFieldShow.FieldType==2?"selected='selected' ":"" %>>多行文本</option>
                        <option value="3" <%=modelCmsFieldShow.FieldType==3?"selected='selected' ":"" %>>多行文本HTML</option>
                        <option value="4" <%=modelCmsFieldShow.FieldType==4?"selected='selected' ":"" %>>单选按钮</option>
                        <option value="7" <%=modelCmsFieldShow.FieldType==7?"selected='selected' ":"" %>>下拉列表</option>
                        <option value="8" <%=modelCmsFieldShow.FieldType==8?"selected='selected' ":"" %>>数字型</option>
                        <option value="9" <%=modelCmsFieldShow.FieldType==9?"selected='selected' ":"" %>>日期和时间</option>
                        <option value="10" <%=modelCmsFieldShow.FieldType==10?"selected='selected' ":"" %>>图片</option>
                        <option value="11" <%=modelCmsFieldShow.FieldType==11?"selected='selected' ":"" %>>附加字段属性</option>
                    </select>
                </td>
            </tr>
            <tr id="trDefaultValue" <%=modelCmsFieldShow.FieldType==9||modelCmsFieldShow.FieldType==11?"style='display:none;'":"" %>>
                <td width="20%" align="left">
                    <img name="help1" src="../pic/icons/help.gif" alt="默认值" onclick="helpInf(this)" />&nbsp;默认值：</td>
                <td>
                    <input name="txtDefaultValue" type="text" id="txtDefaultValue" value="<%=modelCmsFieldShow.DefaultValue %>"
                        style="width: 124px;" /></td>
            </tr>
            <tr id="trinputlength" <%=modelCmsFieldShow.FieldType!=1?"style='display:none;'":"" %>>
                <td width="20%" align="left">
                    <img name="help1" src="../pic/icons/help.gif" alt="文本框长度" onclick="helpInf(this)" />&nbsp;文本框长度</td>
                <td>
                    <input name="txtWidth" valid=" <%=modelCmsFieldShow.FieldType!=1?"required|":"" %>isInt"
                        errmsg="<%=modelCmsFieldShow.FieldType!=1?"文本框长度不能为空|":"" %>只能为数字" type="text"
                        id="txtWidth" value="<%=modelCmsFieldShow.StyleValue %>" style="width: 124px" /><span
                            class="redstar">*</span>单位：px（页面样式）
                </td>
            </tr>
            <tr id="trmax" <%=modelCmsFieldShow.FieldType==1?"":"style='display:none;'" %>>
                <td width="20%" align="left">
                    <img name="help1" src="../pic/icons/help.gif" alt="最大字符数" onclick="helpInf(this)" />&nbsp;最大字符数</td>
                <td>
                    <input name="txtMaxLength" valid="<%=modelCmsFieldShow.FieldType==1?"":"required|" %>isInt"
                        errmsg="<%=modelCmsFieldShow.FieldType==1?"最大字符数不能为空|":"" %>只能为数字" type="text"
                        value="<%=modelCmsFieldShow.MaxValue %>" id="txtMaxLength" style="width: 124px" /><span
                            class="redstar">*</span>（数据库字段）</td>
            </tr>
            <tr id="trwidth" <%=modelCmsFieldShow.FieldType==2||modelCmsFieldShow.FieldType==3?"":"style='display:none;'" %>>
                <td width="20%" align="left">
                    <img name="help1" src="../pic/icons/help.gif" alt="显示宽度" onclick="helpInf(this)" />&nbsp;显示宽度</td>
                <td>
                    <input name="showwidth" valid="<%=modelCmsFieldShow.FieldType==2||modelCmsFieldShow.FieldType==3?"":"required|" %>isInt"
                        errmsg="<%=modelCmsFieldShow.FieldType==2||modelCmsFieldShow.FieldType==3?"":"显示宽度不能为空|" %>只能为数字"
                        type="text" value="<%if(modelCmsFieldShow.StyleValue!=null){if(modelCmsFieldShow.StyleValue.Contains("-")){ Response.Write( modelCmsFieldShow.StyleValue.Split("-".ToCharArray())[0] );}}%>"
                        id="Text1" style="width: 124px" />单位：px（页面样式）</td>
            </tr>
            <tr id="height" <%=modelCmsFieldShow.FieldType==2||modelCmsFieldShow.FieldType==3?"":"style='display:none;'" %>>
                <td width="20%" align="left">
                    <img name="help1" src="../pic/icons/help.gif" alt="显示高度" onclick="helpInf(this)" />&nbsp;显示高度</td>
                <td>
                    <input name="showheight" valid="<%=modelCmsFieldShow.FieldType==2||modelCmsFieldShow.FieldType==3?"":"required|" %>isInt"
                        errmsg="<%=modelCmsFieldShow.FieldType==2||modelCmsFieldShow.FieldType==3?"":"显示高度不能为空|" %>只能为数字"
                        type="text" value="<%
                     if (modelCmsFieldShow.StyleValue !=null)
{
    if(modelCmsFieldShow.StyleValue.Contains("-")){ Response.Write( modelCmsFieldShow.StyleValue.Split("-".ToCharArray())[1] );}
}%>" id="Text2" style="width: 124px" />单位:px（页面样式）</td>
            </tr>
            <tr id="selectlist" <%=modelCmsFieldShow.FieldType==7?"":"style='display:none;'" %>>
                <td width="20%" align="left">
                    <img name="help1" src="../pic/icons/help.gif" alt="选择性属性列表" onclick="helpInf(this)" />&nbsp;选择性属性列表</td>
                <td>
                    <textarea name="selectedlist" cols="80" rows="5"><%=modelCmsFieldShow.StyleValue %></textarea><br />
                    <span style="color: blue">一行为一个选择性属性选项</span>
                </td>
            </tr>
            <tr id="datetime" <%=modelCmsFieldShow.FieldType==9?"":"style='display:none;'" %>>
                <td width="20%" align="left">
                    <img name="help1" src="../pic/icons/help.gif" alt="日期和时间格式" onclick="helpInf(this)" />&nbsp;日期和时间格式</td>
                <td>
                    <table id="DateTimeType" border="0">
                        <tr>
                            <td>
                                <input id="DateTimeType_0" type="radio" name="DateTimeType" value="yyyy-MM-dd" checked="checked" /><label
                                    for="DateTimeType_0">仅日期</label></td>
                        </tr>
                        <tr>
                            <td>
                                <input id="DateTimeType_1" type="radio" name="DateTimeType" value="yyyy-MM-dd HH:mm:ss" /><label
                                    for="DateTimeType_1">日期和时间</label></td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr id="datedefault" <%=modelCmsFieldShow.FieldType==9?"":"style='display:none;'" %>>
                <td width="20%" align="left">
                    <img name="help1" src="../pic/icons/help.gif" alt="日期默认值" onclick="helpInf(this)" />&nbsp;日期默认值</td>
                <td>
                    <table border="0">
                        <tr>
                            <td>
                                <input id="DateTimeDefaultValue_0" type="radio" name="DateTimeDefaultValue" value="0" /><label
                                    for="DateTimeDefaultValue_0">无</label></td>
                        </tr>
                        <tr>
                            <td>
                                <input id="DateTimeDefaultValue_1" type="radio" name="DateTimeDefaultValue" value="1"
                                    checked="checked" /><label for="DateTimeDefaultValue_1">当前日期</label></td>
                        </tr>
                        <tr>
                            <td>
                                <input id="DateTimeDefaultValue_2" type="radio" name="DateTimeDefaultValue" value="2" /><label
                                    for="DateTimeDefaultValue_2">指定日期</label></td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr id="trfieldplusattr" <%=modelCmsFieldShow.FieldType==11?"":"style='display:none;'" %>>
                <td width="20%" align="left">
                    <img name="help1" src="../pic/icons/help.gif" alt="附加字段属性" onclick="helpInf(this)" />&nbsp;附加字段属性</td>
                <td>
                    <table border="0">
                        <tr>
                            <td>
                                <select name="fieldplusattrvalue">
                                    <%=GetFieldPlus(modelCmsFieldShow.StyleValue)%>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="checkbox" name="istab" value="1" <%=modelCmsFieldShow.IsTab==0?"":"checked='checked'" %> />是否用于Tab导航
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <input type="submit" name="btnsubmit" value="确 定" id="Ok" class="button" />&nbsp;&nbsp;
                    <input type="button" name="Cancel" value="取 消" onclick="window.parent.ymPrompt.doHandler('close');"
                        id="Cancel" class="button" />
                </td>
            </tr>
        </table>
    </form>
</body>
</html>
